# RenameModule.cmake
#
# Rename module
#
MACRO(RENAME_MODULE TARGET_NAME NEW_NAME)

    SET(LIB_NAME ${CMAKE_SHARED_LIBRARY_PREFIX}${NEW_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
    SET(NEW_LIB_NAME ${NEW_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})

    ADD_CUSTOM_COMMAND(TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy ${CMAKE_CFG_INTDIR}/${LIB_NAME} ${CMAKE_CFG_INTDIR}/${NEW_LIB_NAME})

    ADD_CUSTOM_COMMAND(TARGET ${TARGET_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E remove ${CMAKE_CFG_INTDIR}/${LIB_NAME})

ENDMACRO(RENAME_MODULE)
